package com.atguigu.order.config;

import feign.Retryer;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class OrderServiceConfig {
    @LoadBalanced
    @Bean
    RestTemplate restTemplate() {
        return new RestTemplate();
    }

//    @Bean
//    Logger.Level feignLogger() {
//        return Logger.Level.FULL;
//    }

    @Bean
    Retryer retryer() {
        //默认重试策略，等待100毫秒，最大间隔1秒，最多重试5次，构造方法里面传递
        return new Retryer.Default();
    }
}
